package com.fuxian.dao.mybatisImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
import com.fuxian.dao.TeacherLessonDao;
import com.fuxian.model.Teacherlessons;

@Repository
public class TeacherLessonDaoMybatisImpl implements TeacherLessonDao {

	@Resource
	private SqlSessionTemplate sqlSessionTemplate;
	public void addTeacherLesson(Teacherlessons teacherlessons) {
sqlSessionTemplate.insert("addTeacherlessons",teacherlessons);		
	}

	public void deleteTeacherLessonById(int teacher_id,int lesson_id) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("teacher_id", teacher_id);
		map.put("lesson_id", lesson_id);
		sqlSessionTemplate.delete("deleteTeacherlessonsById",map);
	}

	public void modifyTeacherLesson(Teacherlessons teacherlessons) {
sqlSessionTemplate.update("modifyTeacherlessons", teacherlessons);		
	}

	public List<Teacherlessons> selectTeacherLesson(int start, int size) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("start", start);
		map.put("size", size);
		return sqlSessionTemplate.selectList("selectAllTeacherlessons", map);
	}

	public List<Teacherlessons> selectTeacherLesson(int teacher_id) {
		
		return sqlSessionTemplate.selectList("selectTeacherLesson", teacher_id);
	}

	public List<Teacherlessons> selectTeacherLessonByLessonId(int lessonId) {
	return sqlSessionTemplate.selectList("selectTeacherLessonByLessonId", lessonId);
	}

	

}
